<?php

function total($obj, $attributes)
{
	$count = count($attributes);
	$value = 0;
	for ($index = 0; $index < $count; $index++) 
	{
		$attName = $attributes[$index];
		$attValue = $obj->$attName;
		$value = $value + $attValue;
	}
	return $value;
}

?>